package org.sith.taskrunner.gwt.client.event;


import com.google.gwt.event.shared.GwtEvent;

public class GuiActionEvent extends GwtEvent<GuiActionEventHandler> {
    public static final Type<GuiActionEventHandler> TYPE = new Type<GuiActionEventHandler>();

    public void setEventType(EventType eventType) {
        this.eventType = eventType;
    }

    public enum EventType {
        SHOW_USERS, ADD_USER
    }

    private EventType eventType;


    @Override
    public Type<GuiActionEventHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(GuiActionEventHandler handler) {
        switch (eventType) {
            case SHOW_USERS: {
                handler.showUsers(this);
            }
            break;
            case ADD_USER: {
                handler.showUserManage(this);
            }     break;
            default: {
            }
            break;
        }
    }
}
